package com.itheima.d5_collection_exception;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

public class CollectionTest1 {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("小李子");
        list.add("小王");
        list.add("小张");
        System.out.println(list);

        Iterator<String> it =list.iterator();
        while (it.hasNext()){
            String name = it.next();
            if(name.contains("小")){
                it.remove();
            }
        }
        System.out.println(list);
    }
}
